package com.slz3.business.module.memberManagement.memCollect.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.memberManagement.memCollect.domain.MemCollect;
import com.slz3.business.module.memberManagement.memCollect.domain.MemCollectFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class MemCollectTransactionalServiceImpl implements MemCollectTransactionalService {

    @Override
    public MemCollect modify(MemCollect memCollectNew) {
        Repositorys.memCollect.test();
        Repositorys.memCollect.save(MemCollectFactory.initBaseFields());
        System.err.println(1/0);
        memCollectNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.memCollect.saveAndFlush(memCollectNew);
    }

    @Override
    public List<MemCollect> batchModify(List<MemCollect> memCollectList) {
        return Repositorys.memCollect.saveAll(memCollectList);
    }
}
